package com.jeesite.modules.mo.entity;

import javax.validation.constraints.Size;
import java.util.Date;
import com.jeesite.common.mybatis.annotation.JoinTable;
import com.jeesite.common.mybatis.annotation.JoinTable.Type;
import com.fasterxml.jackson.annotation.JsonFormat;

import com.jeesite.common.entity.DataEntity;
import com.jeesite.common.mybatis.annotation.Column;
import com.jeesite.common.mybatis.annotation.Table;
import com.jeesite.common.mybatis.mapper.query.QueryType;
import com.jeesite.modules.ic.entity.IcUser;

/**
 * mo_shouyiEntity
 * @author 李寒冰
 * @version 2024-10-22
 */
@Table(name="mo_shouyi", alias="a", label="mo_shouyi信息", columns={
		@Column(name="id", attrName="id", label="id", isPK=true),
		@Column(name="sn", attrName="sn", label="SN"),
		@Column(name="user_id", attrName="userId", label="用户ID"),
		@Column(name="amount", attrName="amount", label="收益", isUpdateForce=true),
		@Column(name="type", attrName="type", label="1 自己宽带 2 宽带提成", isUpdateForce=true),
		@Column(name="next_user_id", attrName="nextUserId", label="下级用户Id"),
		@Column(name="work_date", attrName="workDate", label="收益日期", isUpdateForce=true),
		@Column(name="create_time", attrName="createTime", label="create_time", isUpdateForce=true),
	}, orderBy="a.work_date DESC"
)
public class MoShouyi extends DataEntity<MoShouyi> {
	
	private static final long serialVersionUID = 1L;
	private String sn;		// SN
	private String userId;		// 用户ID
	private Double amount;		// 收益
	private Integer type;		// 1 自己宽带 2 宽带提成
	private String nextUserId;		// 下级用户Id
	private Date workDate;		// 收益日期
	private Date createTime;		// create_time


	//扩展字段
	private IcUser nextUser;

	public IcUser getNextUser() {
		return nextUser;
	}

	public void setNextUser(IcUser nextUser) {
		this.nextUser = nextUser;
	}

	public MoShouyi() {
		this(null);
	}
	
	public MoShouyi(String id){
		super(id);
	}
	
	@Size(min=0, max=255, message="SN长度不能超过 255 个字符")
	public String getSn() {
		return sn;
	}

	public void setSn(String sn) {
		this.sn = sn;
	}
	
	@Size(min=0, max=50, message="用户ID长度不能超过 50 个字符")
	public String getUserId() {
		return userId;
	}

	public void setUserId(String userId) {
		this.userId = userId;
	}
	
	public Double getAmount() {
		return amount;
	}

	public void setAmount(Double amount) {
		this.amount = amount;
	}
	
	public Integer getType() {
		return type;
	}

	public void setType(Integer type) {
		this.type = type;
	}
	
	@Size(min=0, max=50, message="下级用户Id长度不能超过 50 个字符")
	public String getNextUserId() {
		return nextUserId;
	}

	public void setNextUserId(String nextUserId) {
		this.nextUserId = nextUserId;
	}
	
	@JsonFormat(pattern = "yyyy-MM-dd")
	public Date getWorkDate() {
		return workDate;
	}

	public void setWorkDate(Date workDate) {
		this.workDate = workDate;
	}
	
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	public Date getCreateTime() {
		return createTime;
	}

	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}

	public void setWorkDateStart(String workDateStart) {
		this.sqlMap.getWhere().and("work_date",QueryType.GTE,workDateStart);
	}

	public void setWorkDateEnd(String workDateEnd) {
		this.sqlMap.getWhere().and("work_date",QueryType.LTE,workDateEnd);
	}
	
}